﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.Text;
using QCCM2;


namespace WCF_QCCM
{

    //public int GetIDfromName(string Name)
    //{
    //    string n = Name;
    //    return qca.GetIDfromName(n);
    //}

    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "QCAService" in both code and config file together.
    public class QCAService : IQCAService
    {
        QCAttrib qca = new QCAttrib();
        Material qcm = new Material();
        MaterialQCAttrib mqca = new MaterialQCAttrib();
        QCSchedule qcs = new QCSchedule();

        
        //QCAttrib
        public List<QCAttrib> GetAttribs()
        {
            return qca.GetAttribs();
        }

        public string AddQCAttrib(string Name, string TypeOfData, string Desc, bool Disabled)
        {
            string n = Name;
            string td = TypeOfData;
            string desc = Desc;
            bool dis = Disabled;

            return qca.AddQCAttrib(n, td, desc, dis);
        }

        public string UpdateQCAttrib(string Name, string TypeOfData, string Desc, bool Disabled)
        {
            return qca.UpdateQCAttrib(Name, TypeOfData, Desc, Disabled);
        }

        public string DeleteQCAttrib(string Name)
        {
            return qca.DeleteQCAttrib(Name);
        }

        public QCAttrib SearchQCAttrib(string Name)
        {
            return qca.SearchQCAttrib(Name);
        }

        //Material
    

        public IEnumerable<Material> GetAllMaterials()
        {
            return qcm.GetAllMaterials();
        }

        public string AddMaterial(string materialName, string materialDescription, bool materialDisabled)
        {
            return qcm.AddMaterial(materialName, materialDescription, materialDisabled);
        }

        public string UpdateMaterial(string materialName, string materialDescription, bool materialDisabled)
        {
            return qcm.UpdateMaterial(materialName, materialDescription, materialDisabled);
        }

        public string DeleteMaterial(string materialName)
        {
            return qcm.DeleteMaterial(materialName);
        }


        //MATERIAL QCATTRIBUTE
 
        public List<MaterialQCAttrib> GetAllMaterialQCAttrib()
        {
            return mqca.GetAllMaterialQCAttrib();
        }

        public bool AddMaterialQCA(MaterialQCAttrib obj)
        {
            return mqca.AddMaterialQCAttrib(obj);
        }

        public bool UpdateMaterialQCA(MaterialQCAttrib obj)
         {
             return mqca.UpdateMaterialQCAttrib(obj);
         }

       
        public bool DeleteMaterialQCAttrib(MaterialQCAttrib obj)
         {
             return mqca.DeleteMaterialQCAttrib(obj);
         }


        //QCSCHEDULE.cs

        public List<QCSchedule> GetAllQCSchedules()
        {
            return qcs.GetAllQCSchedules();
        }

        public string AddQCSchedule(int materialID, int qcAttribID, string hour, string day, int groupID, bool qcScheduleDisabled)
        {


            return qcs.AddQCSchedule(materialID, qcAttribID, hour, day, groupID, qcScheduleDisabled);
        }


        public string UpdateQCSchedule(int materialID, int qcAttribID, string hour, string day, int groupID, bool qcScheduleDisabled)
        {
            return qcs.UpdateQSchedule(materialID, qcAttribID, hour, day, groupID, qcScheduleDisabled);
        }

        public string DeleteQCSchedule(int materialID, int qcAttribID, int groupID)
        {
            return qcs.DeleteQCSchedule(materialID, qcAttribID, groupID);
        }
     
    }
}
